reflections.js 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259
  1. (() => {
  2. var exports = {};
  3. exports.id = 39883;
  4. exports.ids = [39883,64820];
  5. exports.modules = {
  6. /***/ 50478:
  7. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  8. "use strict";
  9. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  10. __webpack_require__.r(__webpack_exports__);
  11. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12. /* harmony export */ "default": () => (/* binding */ pageWrapperTemplate),
  13. /* harmony export */ "getServerSideProps": () => (/* binding */ getServerSideProps),
  14. /* harmony export */ "getStaticPaths": () => (/* binding */ getStaticPaths),
  15. /* harmony export */ "getStaticProps": () => (/* binding */ getStaticProps)
  16. /* harmony export */ });
  17. /* harmony import */ var _sentry_server_config_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(96270);
  18. /* harmony import */ var _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58097);
  19. /* harmony import */ var _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__);
  20. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20997);
  21. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__);
  22. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16689);
  23. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
  24. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(60866);
  25. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4__);
  26. /* harmony import */ var swr__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(15941);
  27. /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(92684);
  28. /* harmony import */ var _components_NextSeoWrapper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25869);
  29. /* harmony import */ var _components_QuranReader_ReflectionView_ReflectionBodyContainer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(86325);
  30. /* harmony import */ var _lib_og__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(11670);
  31. /* harmony import */ var _pages_error__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(36049);
  32. /* harmony import */ var _pages_index_module_scss__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(23848);
  33. /* harmony import */ var _pages_index_module_scss__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_pages_index_module_scss__WEBPACK_IMPORTED_MODULE_20__);
  34. /* harmony import */ var _redux_defaultSettings_util__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(17241);
  35. /* harmony import */ var _utils_api__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4917);
  36. /* harmony import */ var _utils_apiPaths__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(46127);
  37. /* harmony import */ var _utils_chapter__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(95892);
  38. /* harmony import */ var _utils_locale__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(24709);
  39. /* harmony import */ var _utils_navigation__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(57933);
  40. /* harmony import */ var _utils_quranReflect_apiPaths__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(36342);
  41. /* harmony import */ var _utils_staticPageGeneration__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(45137);
  42. /* harmony import */ var _utils_validator__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(41051);
  43. /* harmony import */ var _utils_verse__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(44519);
  44. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([swr__WEBPACK_IMPORTED_MODULE_5__, _components_QuranReader_ReflectionView_ReflectionBodyContainer__WEBPACK_IMPORTED_MODULE_8__, _pages_error__WEBPACK_IMPORTED_MODULE_9__, _utils_navigation__WEBPACK_IMPORTED_MODULE_15__]);
  45. ([swr__WEBPACK_IMPORTED_MODULE_5__, _components_QuranReader_ReflectionView_ReflectionBodyContainer__WEBPACK_IMPORTED_MODULE_8__, _pages_error__WEBPACK_IMPORTED_MODULE_9__, _utils_navigation__WEBPACK_IMPORTED_MODULE_15__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
  46. const SelectedAyahReflection = ({ hasError , chapter , verseNumber , chapterId , fallback , })=>{
  47. const { t , lang } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4___default()("quran-reader");
  48. if (hasError) {
  49. return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_pages_error__WEBPACK_IMPORTED_MODULE_9__["default"], {
  50. statusCode: 500
  51. });
  52. }
  53. const navigationUrl = (0,_utils_navigation__WEBPACK_IMPORTED_MODULE_15__/* .getVerseReflectionNavigationUrl */ .HT)(`${chapterId}:${verseNumber}`);
  54. return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment, {
  55. children: [
  56. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_components_NextSeoWrapper__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
  57. title: `${chapter.chapter.transliteratedName} - ${(0,_utils_locale__WEBPACK_IMPORTED_MODULE_14__/* .toLocalizedNumber */ .rQ)(Number(verseNumber), lang)} ${t("common:reflections")} `,
  58. image: (0,_lib_og__WEBPACK_IMPORTED_MODULE_19__/* .getChapterOgImageUrl */ .oJ)({
  59. chapterId,
  60. verseNumber,
  61. locale: lang
  62. }),
  63. imageWidth: 1200,
  64. imageHeight: 630,
  65. canonical: (0,_utils_navigation__WEBPACK_IMPORTED_MODULE_15__/* .getCanonicalUrl */ .Z2)(lang, navigationUrl),
  66. languageAlternates: (0,_utils_locale__WEBPACK_IMPORTED_MODULE_14__/* .getLanguageAlternates */ .qc)(navigationUrl),
  67. description: t("reflections-desc", {
  68. ayahNumber: verseNumber,
  69. surahName: chapter.chapter.transliteratedName
  70. })
  71. }),
  72. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(swr__WEBPACK_IMPORTED_MODULE_5__.SWRConfig, {
  73. value: {
  74. fallback
  75. },
  76. children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  77. className: (_pages_index_module_scss__WEBPACK_IMPORTED_MODULE_20___default().pageContainer),
  78. children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  79. className: (_pages_index_module_scss__WEBPACK_IMPORTED_MODULE_20___default().flow),
  80. children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  81. className: (_pages_index_module_scss__WEBPACK_IMPORTED_MODULE_20___default().flowItem),
  82. children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_components_QuranReader_ReflectionView_ReflectionBodyContainer__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {
  83. scrollToTop: _utils_navigation__WEBPACK_IMPORTED_MODULE_15__/* .scrollWindowToTop */ .hb,
  84. initialChapterId: chapterId,
  85. initialVerseNumber: verseNumber.toString(),
  86. render: ({ body , surahAndAyahSelection })=>{
  87. return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
  88. children: [
  89. surahAndAyahSelection,
  90. body
  91. ]
  92. });
  93. }
  94. })
  95. })
  96. })
  97. })
  98. })
  99. ]
  100. });
  101. };
  102. const getStaticProps$1 = async ({ params , locale })=>{
  103. const { chapterId } = params;
  104. const verseKey = String(chapterId);
  105. const chaptersData = await (0,_utils_chapter__WEBPACK_IMPORTED_MODULE_13__/* .getAllChaptersData */ .T4)(locale);
  106. if (!(0,_utils_validator__WEBPACK_IMPORTED_MODULE_17__/* .isValidVerseKey */ .CG)(chaptersData, verseKey)) {
  107. return {
  108. notFound: true
  109. };
  110. }
  111. const [chapterNumber, verseNumber] = (0,_utils_verse__WEBPACK_IMPORTED_MODULE_18__/* .getVerseAndChapterNumbersFromKey */ .bV)(verseKey);
  112. const { quranFont , mushafLines } = (0,_redux_defaultSettings_util__WEBPACK_IMPORTED_MODULE_10__/* .getQuranReaderStylesInitialState */ .kq)(locale);
  113. const translations = (0,_redux_defaultSettings_util__WEBPACK_IMPORTED_MODULE_10__/* .getTranslationsInitialState */ .h0)(locale).selectedTranslations;
  114. try {
  115. const verseReflectionUrl = (0,_utils_quranReflect_apiPaths__WEBPACK_IMPORTED_MODULE_16__/* .makeAyahReflectionsUrl */ .pZ)({
  116. surahId: chapterNumber,
  117. ayahNumber: verseNumber,
  118. locale
  119. });
  120. const mushafId = (0,_utils_api__WEBPACK_IMPORTED_MODULE_11__/* .getMushafId */ .$P)(quranFont, mushafLines).mushaf;
  121. const apiParams = {
  122. ...(0,_utils_api__WEBPACK_IMPORTED_MODULE_11__/* .getDefaultWordFields */ .hD)(quranFont),
  123. translationFields: "resource_name,language_id",
  124. translations: translations.join(","),
  125. mushaf: mushafId,
  126. from: `${chapterNumber}:${verseNumber}`,
  127. to: `${chapterNumber}:${verseNumber}`
  128. };
  129. const versesUrl = (0,_utils_apiPaths__WEBPACK_IMPORTED_MODULE_12__/* .makeVersesUrl */ .ML)(chapterNumber, locale, apiParams);
  130. const [verseReflectionsData, versesData] = await Promise.all([
  131. (0,_utils_quranReflect_apiPaths__WEBPACK_IMPORTED_MODULE_16__/* .getAyahReflections */ .Jc)(verseReflectionUrl),
  132. (0,_api__WEBPACK_IMPORTED_MODULE_6__/* .fetcher */ ._i)(versesUrl),
  133. ]);
  134. const fallback = {
  135. [verseReflectionUrl]: verseReflectionsData,
  136. [versesUrl]: versesData
  137. };
  138. return {
  139. props: {
  140. chaptersData,
  141. chapterId: chapterNumber,
  142. chapter: {
  143. chapter: (0,_utils_chapter__WEBPACK_IMPORTED_MODULE_13__/* .getChapterData */ .dy)(chaptersData, chapterNumber)
  144. },
  145. verseNumber,
  146. fallback
  147. },
  148. revalidate: _utils_staticPageGeneration__WEBPACK_IMPORTED_MODULE_21__/* .ONE_WEEK_REVALIDATION_PERIOD_SECONDS */ .Dp
  149. };
  150. } catch (error) {
  151. return {
  152. props: {
  153. hasError: true
  154. },
  155. revalidate: _utils_staticPageGeneration__WEBPACK_IMPORTED_MODULE_21__/* .REVALIDATION_PERIOD_ON_ERROR_SECONDS */ .eW
  156. };
  157. }
  158. };
  159. const getStaticPaths = async ()=>({
  160. paths: [],
  161. fallback: "blocking"
  162. });
  163. var serverComponentModule = /*#__PURE__*/Object.freeze({
  164. __proto__: null,
  165. getStaticProps: getStaticProps$1,
  166. getStaticPaths: getStaticPaths,
  167. 'default': SelectedAyahReflection
  168. });
  169. /*
  170. * This file is a template for the code which will be substituted when our webpack loader handles non-API files in the
  171. * `pages/` directory.
  172. *
  173. * We use `__SENTRY_WRAPPING_TARGET_FILE__.cjs` as a placeholder for the path to the file being wrapped. Because it's not a real package,
  174. * this causes both TS and ESLint to complain, hence the pragma comments below.
  175. */
  176. const userPageModule = serverComponentModule ;
  177. const pageComponent = userPageModule ? userPageModule.default : undefined;
  178. const origGetInitialProps = pageComponent ? pageComponent.getInitialProps : undefined;
  179. const origGetStaticProps = userPageModule ? userPageModule.getStaticProps : undefined;
  180. const origGetServerSideProps = userPageModule ? userPageModule.getServerSideProps : undefined;
  181. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  182. const getInitialPropsWrappers = {
  183. '/_app': _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapAppGetInitialPropsWithSentry,
  184. '/_document': _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapDocumentGetInitialPropsWithSentry,
  185. '/_error': _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapErrorGetInitialPropsWithSentry,
  186. };
  187. const getInitialPropsWrapper = getInitialPropsWrappers['/[chapterId]/reflections'] || _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapGetInitialPropsWithSentry;
  188. if (pageComponent && typeof origGetInitialProps === 'function') {
  189. pageComponent.getInitialProps = getInitialPropsWrapper(origGetInitialProps) ;
  190. }
  191. const getStaticProps =
  192. typeof origGetStaticProps === 'function'
  193. ? _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapGetStaticPropsWithSentry(origGetStaticProps, '/[chapterId]/reflections')
  194. : undefined;
  195. const getServerSideProps =
  196. typeof origGetServerSideProps === 'function'
  197. ? _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapGetServerSidePropsWithSentry(origGetServerSideProps, '/[chapterId]/reflections')
  198. : undefined;
  199. const pageWrapperTemplate = pageComponent ? _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapPageComponentWithSentry(pageComponent ) : pageComponent;
  200. __webpack_async_result__();
  201. } catch(e) { __webpack_async_result__(e); } });
  202. /***/ }),
  203. /***/ 5293:
  204. /***/ ((module) => {
  205. // Exports
  206. module.exports = {
  207. "container": "TafsirView_container__R9G7I",
  208. "tafsirName": "TafsirView_tafsirName__QPOiO",
  209. "tafsirContainer": "TafsirView_tafsirContainer__g2rhW",
  210. "rtl": "TafsirView_rtl__8pRLP",
  211. "surahAndAyahSelectionContainer": "TafsirView_surahAndAyahSelectionContainer__W96nf",
  212. "tafsirSelectionContainer": "TafsirView_tafsirSelectionContainer__QSkE3",
  213. "tafsirSelectionItem": "TafsirView_tafsirSelectionItem__GTJvw",
  214. "tafsirItemSelected": "TafsirView_tafsirItemSelected__SXceL",
  215. "separatorContainer": "TafsirView_separatorContainer__diS8n",
  216. "verseTextContainer": "TafsirView_verseTextContainer__A7tZ_",
  217. "selectionItem": "TafsirView_selectionItem__FJdhi",
  218. "ayahSelection": "TafsirView_ayahSelection__jWULb",
  219. "tafsirSkeletonItem": "TafsirView_tafsirSkeletonItem__q5sNk",
  220. "ayahSekletonItem": "TafsirView_ayahSekletonItem__B_nJN",
  221. "tafsirSkeletonItem1": "TafsirView_tafsirSkeletonItem1__nLGRk",
  222. "tafsirSkeletonItem2": "TafsirView_tafsirSkeletonItem2__aaEJy",
  223. "tafsirSkeletonItem3": "TafsirView_tafsirSkeletonItem3__NqYKV",
  224. "tafsirSelectionSkeleton": "TafsirView_tafsirSelectionSkeleton__3oq7k",
  225. "languageSelection": "TafsirView_languageSelection__8EFqZ",
  226. "tafsir-font-size-1": "TafsirView_tafsir-font-size-1__sLRnq",
  227. "tafsir-font-size-2": "TafsirView_tafsir-font-size-2__JLiR2",
  228. "tafsir-font-size-3": "TafsirView_tafsir-font-size-3__K0LBa",
  229. "tafsir-font-size-4": "TafsirView_tafsir-font-size-4__KrD1k",
  230. "tafsir-font-size-5": "TafsirView_tafsir-font-size-5__ri_Mr",
  231. "tafsir-font-size-6": "TafsirView_tafsir-font-size-6__FvBko",
  232. "tafsir-font-size-7": "TafsirView_tafsir-font-size-7__oS0XU",
  233. "tafsir-font-size-8": "TafsirView_tafsir-font-size-8__1U_43",
  234. "tafsir-font-size-9": "TafsirView_tafsir-font-size-9__6VJC2",
  235. "tafsir-font-size-10": "TafsirView_tafsir-font-size-10__zRYWI"
  236. };
  237. /***/ }),
  238. /***/ 96318:
  239. /***/ ((module) => {
  240. // Exports
  241. module.exports = {
  242. "baseSize": "Skeleton_baseSize__RsOkc",
  243. "skeleton": "Skeleton_skeleton__u2Uso",
  244. "active": "Skeleton_active__5df2K",
  245. "loading": "Skeleton_loading__iZh50",
  246. "rounded": "Skeleton_rounded__ftYYr",
  247. "content": "Skeleton_content__knKtV"
  248. };
  249. /***/ }),
  250. /***/ 23848:
  251. /***/ ((module) => {
  252. // Exports
  253. module.exports = {
  254. "pageContainer": "index_pageContainer__Pxtn3",
  255. "loadingContainer": "index_loadingContainer__WEZFc",
  256. "flow": "index_flow__rCTR5",
  257. "flowItem": "index_flowItem__GnXWz",
  258. "additionalVerticalGap": "index_additionalVerticalGap__nzYz6",
  259. "fullWidth": "index_fullWidth__1n4ux"
  260. };
  261. /***/ }),
  262. /***/ 86325:
  263. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  264. "use strict";
  265. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  266. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  267. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  268. /* harmony export */ });
  269. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  270. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  271. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  272. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  273. /* harmony import */ var next_dynamic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96954);
  274. /* harmony import */ var next_dynamic__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_dynamic__WEBPACK_IMPORTED_MODULE_2__);
  275. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(60866);
  276. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__);
  277. /* harmony import */ var _components_DataFetcher__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12951);
  278. /* harmony import */ var _components_QuranReader_observer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(94082);
  279. /* harmony import */ var _components_QuranReader_TafsirView_TafsirSkeleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1627);
  280. /* harmony import */ var _hooks_useGlobalIntersectionObserverWithDelay__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91398);
  281. /* harmony import */ var _utils_auth_login__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(22197);
  282. /* harmony import */ var _utils_auth_qf_api__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91450);
  283. /* harmony import */ var _utils_quranReflect_apiPaths__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(36342);
  284. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_components_DataFetcher__WEBPACK_IMPORTED_MODULE_4__, _utils_auth_login__WEBPACK_IMPORTED_MODULE_7__]);
  285. ([_components_DataFetcher__WEBPACK_IMPORTED_MODULE_4__, _utils_auth_login__WEBPACK_IMPORTED_MODULE_7__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
  286. const ReflectionSurahAndAyahSelection = next_dynamic__WEBPACK_IMPORTED_MODULE_2___default()(null, {
  287. loadableGenerated: {
  288. modules: [
  289. "../components/QuranReader/ReflectionView/ReflectionBodyContainer/index.tsx -> " + "./ReflectionSurahAndAyahSelection"
  290. ]
  291. },
  292. ssr: false
  293. });
  294. const ReflectionBody = next_dynamic__WEBPACK_IMPORTED_MODULE_2___default()(null, {
  295. loadableGenerated: {
  296. modules: [
  297. "../components/QuranReader/ReflectionView/ReflectionBodyContainer/index.tsx -> " + "./ReflectionBody"
  298. ]
  299. },
  300. ssr: false,
  301. loading: _components_QuranReader_TafsirView_TafsirSkeleton__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z
  302. });
  303. const ReflectionBodyContainer = ({ render , initialChapterId , initialVerseNumber , scrollToTop })=>{
  304. const { 0: selectedChapterId , 1: setSelectedChapterId } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(initialChapterId);
  305. const { 0: selectedVerseNumber , 1: setSelectedVerseNumber } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(initialVerseNumber);
  306. const { lang } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default()();
  307. /**
  308. * Handle when the reflection is viewed:
  309. *
  310. * 1. If the user is logged in, we will call QDC's backend API.
  311. * 2. Otherwise, we will call QR's API directly.
  312. */ const onReflectionViewed = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((reflectionContainer)=>{
  313. const postId = reflectionContainer.getAttribute("data-post-id");
  314. if ((0,_utils_auth_login__WEBPACK_IMPORTED_MODULE_7__/* .isLoggedIn */ .jl)()) {
  315. // eslint-disable-next-line @typescript-eslint/no-empty-function
  316. (0,_utils_auth_qf_api__WEBPACK_IMPORTED_MODULE_8__/* .postReflectionViews */ .GG)(postId).catch(()=>{});
  317. } else {
  318. // eslint-disable-next-line @typescript-eslint/no-empty-function
  319. (0,_utils_quranReflect_apiPaths__WEBPACK_IMPORTED_MODULE_9__/* .postReflectionViews */ .GG)(postId).catch(()=>{});
  320. }
  321. }, []);
  322. (0,_hooks_useGlobalIntersectionObserverWithDelay__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)({
  323. threshold: 1
  324. }, onReflectionViewed, _components_QuranReader_observer__WEBPACK_IMPORTED_MODULE_10__/* .REFLECTIONS_OBSERVER_ID */ .yG, "postId", "countAsViewedAfter");
  325. const renderBody = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((data)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(ReflectionBody, {
  326. data: data,
  327. selectedChapterId: selectedChapterId,
  328. selectedVerseNumber: selectedVerseNumber,
  329. setSelectedVerseNumber: setSelectedVerseNumber,
  330. scrollToTop: scrollToTop
  331. }), [
  332. scrollToTop,
  333. selectedChapterId,
  334. selectedVerseNumber
  335. ]);
  336. const body = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_DataFetcher__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
  337. loading: _components_QuranReader_TafsirView_TafsirSkeleton__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z,
  338. queryKey: (0,_utils_quranReflect_apiPaths__WEBPACK_IMPORTED_MODULE_9__/* .makeAyahReflectionsUrl */ .pZ)({
  339. surahId: selectedChapterId,
  340. ayahNumber: selectedVerseNumber,
  341. locale: lang
  342. }),
  343. render: renderBody
  344. });
  345. return render({
  346. surahAndAyahSelection: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(ReflectionSurahAndAyahSelection, {
  347. selectedChapterId: selectedChapterId,
  348. selectedVerseNumber: selectedVerseNumber,
  349. setSelectedChapterId: setSelectedChapterId,
  350. setSelectedVerseNumber: setSelectedVerseNumber
  351. }),
  352. body
  353. });
  354. };
  355. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReflectionBodyContainer);
  356. __webpack_async_result__();
  357. } catch(e) { __webpack_async_result__(e); } });
  358. /***/ }),
  359. /***/ 1627:
  360. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  361. "use strict";
  362. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  363. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  364. /* harmony export */ });
  365. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  366. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  367. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59003);
  368. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
  369. /* harmony import */ var lodash_range__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(64042);
  370. /* harmony import */ var lodash_range__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_range__WEBPACK_IMPORTED_MODULE_2__);
  371. /* harmony import */ var _TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5293);
  372. /* harmony import */ var _TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4__);
  373. /* harmony import */ var _dls_Skeleton_Skeleton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(77048);
  374. const TafsirSkeleton = ()=>{
  375. return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
  376. children: [
  377. /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Skeleton_Skeleton__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
  378. className: ((_TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4___default().tafsirSkeletonItem), (_TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4___default().ayahSekletonItem))
  379. }),
  380. lodash_range__WEBPACK_IMPORTED_MODULE_2___default()(1, 15).map((i)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Skeleton_Skeleton__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
  381. className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4___default().tafsirSkeletonItem), {
  382. [(_TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4___default().tafsirSkeletonItem1)]: i % 1 === 0,
  383. [(_TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4___default().tafsirSkeletonItem2)]: i % 2 === 0,
  384. [(_TafsirView_module_scss__WEBPACK_IMPORTED_MODULE_4___default().tafsirSkeletonItem3)]: i % 3 === 0
  385. })
  386. }, i))
  387. ]
  388. });
  389. };
  390. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TafsirSkeleton);
  391. /***/ }),
  392. /***/ 94082:
  393. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  394. "use strict";
  395. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  396. /* harmony export */ "FW": () => (/* binding */ getOptions),
  397. /* harmony export */ "NM": () => (/* binding */ QURAN_READER_OBSERVER_ID),
  398. /* harmony export */ "s$": () => (/* binding */ getObservedVersePayload),
  399. /* harmony export */ "yG": () => (/* binding */ REFLECTIONS_OBSERVER_ID)
  400. /* harmony export */ });
  401. /**
  402. * The top -131.6px was calculated based on:
  403. *
  404. * 1. the height of emptySpacePlaceholder of navbar (3.6rem).
  405. * 2. the top padding of the QuranReader container (2rem).
  406. * 3. the top and bottom margin of the ReadingPreferenceSwitcher container (1.625rem).
  407. * 4. the top margin of the TranslationView container (1rem).
  408. *
  409. * and the total is 8.225rem around 131.6 pixels.
  410. */ const DEFAULT_ROOT_MARGIN = "-131.6px 0px -68% 0px";
  411. const OBSERVER_THRESHOLD = 0.1;
  412. const QURAN_READER_OBSERVER_ID = "quranReaderObserver";
  413. const REFLECTIONS_OBSERVER_ID = "reflectionsObserver";
  414. /**
  415. * the top -115.6px was calculated based on:
  416. *
  417. * 1. the height of emptySpacePlaceholder of navbar (3.6rem).
  418. * 2. the top padding of the QuranReader container (2rem).
  419. * 3. the top and bottom margin of the ReadingPreferenceSwitcher container (1.625rem).
  420. *
  421. * and the total is 7.225rem around 115.6 pixels.
  422. */ const READING_MODE_ROOT_MARGIN = "-115.6px 0px -70% 0px";
  423. /**
  424. * Get the observer options based on the reading preference.
  425. *
  426. * @param {boolean} isReadingPreference
  427. * @returns {{rootMargin: string, threshold: number | number[]}}
  428. */ const getOptions = (isReadingPreference)=>({
  429. rootMargin: isReadingPreference ? READING_MODE_ROOT_MARGIN : DEFAULT_ROOT_MARGIN,
  430. threshold: OBSERVER_THRESHOLD
  431. });
  432. /**
  433. * Get the payload that will be dispatched to Redux to set the last read verse.
  434. *
  435. * @param {Element} element
  436. * @returns {{verseKey: string,chapterId: string,page: string,hizb: string}}
  437. */ const getObservedVersePayload = (element)=>({
  438. verseKey: element.getAttribute("data-verse-key"),
  439. chapterId: element.getAttribute("data-chapter-id"),
  440. page: element.getAttribute("data-page"),
  441. hizb: element.getAttribute("data-hizb")
  442. });
  443. /***/ }),
  444. /***/ 77048:
  445. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  446. "use strict";
  447. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  448. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  449. /* harmony export */ });
  450. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  451. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  452. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59003);
  453. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
  454. /* harmony import */ var _Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(96318);
  455. /* harmony import */ var _Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2__);
  456. const Skeleton = ({ children , isRounded , isSquared , isActive =true , className })=>{
  457. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
  458. className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2___default().skeleton), {
  459. [(_Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2___default().baseSize)]: !children && !className,
  460. [(_Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2___default().active)]: isActive,
  461. [(_Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2___default().rounded)]: isRounded,
  462. [(_Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2___default().squared)]: isSquared,
  463. [className]: className
  464. }),
  465. children: children && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
  466. className: (_Skeleton_module_scss__WEBPACK_IMPORTED_MODULE_2___default().content),
  467. children: children
  468. })
  469. });
  470. };
  471. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Skeleton);
  472. /***/ }),
  473. /***/ 44063:
  474. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  475. "use strict";
  476. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  477. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  478. /* harmony export */ });
  479. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
  480. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  481. /**
  482. * This is needed to avoid having the following warning:
  483. * Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format.
  484. * The solution is inspired by this thread
  485. * {@link https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85}
  486. */ // eslint-disable-next-line @typescript-eslint/no-empty-function
  487. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ( false ? 0 : ()=>{});
  488. /***/ }),
  489. /***/ 91398:
  490. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  491. "use strict";
  492. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  493. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  494. /* harmony export */ });
  495. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
  496. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  497. /* harmony import */ var _hooks_useBrowserLayoutEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44063);
  498. /* eslint-disable react-func/max-lines-per-function */
  499. const isDev = process.env.NEXT_PUBLIC_VERCEL_ENV === "development";
  500. /**
  501. * Sets a debugging text to element debugger node if we are in a dev environment
  502. * and the element debugger paragraph node exists.
  503. *
  504. * @param {string} text
  505. * @param {HTMLElement} intersectionDebuggerNode
  506. *
  507. */ const setIntersectionDebuggerNodeText = (text, intersectionDebuggerNode)=>{
  508. if (!isDev || !intersectionDebuggerNode) {
  509. return;
  510. }
  511. // eslint-disable-next-line no-param-reassign
  512. intersectionDebuggerNode.textContent = `OBSERVER DEBUGGER: ${text}`;
  513. };
  514. /**
  515. * A hook that will create a global observer and inject it into window so that it's
  516. * globally available. Once it's created, it can be used by any element that would like
  517. * to be observed using that observer using {@see useObserverElement} hook. This hook
  518. * is meant to be used for delayed element visibility callback.
  519. *
  520. * @param {IntersectionObserverInit} options
  521. * @param {(element:Element)=>void} onElementVisible
  522. * @param {string} observerId the name of the observer
  523. * @param {string} elementIdKey the key of the unique identifier of each element.
  524. * @param {string} delayForMSKey the key holding the number of milliseconds after which the observer should trigger the callback
  525. */ const useGlobalIntersectionObserverWithDelay = ({ threshold =1 , root =null , rootMargin ="0%" }, onElementVisible, observerId, elementIdKey, delayForMSKey)=>{
  526. /**
  527. * An object that will hold a reference of each unique identifier and
  528. * the ID of the timeout function that will trigger when the element
  529. * is visible for delayForMS number of seconds.
  530. */ const timeouts = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(new Map());
  531. const updateEntry = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((entries)=>{
  532. entries.forEach((visibleEntry)=>{
  533. let elementIntersectionDebuggerNode;
  534. if (isDev) {
  535. const nodes = visibleEntry.target.getElementsByClassName("debugger");
  536. // if at least one debugger node was found (should always be there but just to be extra sure)
  537. if (nodes.length) {
  538. elementIntersectionDebuggerNode = nodes[0];
  539. }
  540. }
  541. const targetNode = visibleEntry.target;
  542. const elementId = targetNode.dataset[elementIdKey];
  543. const delayForMS = Number(targetNode.dataset[delayForMSKey]);
  544. // if the element content container is interacting
  545. if (visibleEntry.isIntersecting) {
  546. setIntersectionDebuggerNodeText(`Element is fully visible, triggering callback in ${delayForMS / 1000} seconds...`, elementIntersectionDebuggerNode);
  547. // Call the API after delayForMS
  548. timeouts.current.set(elementId, window.setTimeout(()=>{
  549. onElementVisible(visibleEntry.target);
  550. setIntersectionDebuggerNodeText(`Element callback triggered`, elementIntersectionDebuggerNode);
  551. }, delayForMS));
  552. } else {
  553. // if it's no longer intersecting, clear the timeout
  554. clearTimeout(timeouts.current.get(elementId));
  555. /**
  556. * Delete the timeout function's ID from the global array since it's no longer
  557. * needed and next time if the same element intersects, a new ID will be generated
  558. * for that element.
  559. */ timeouts.current.delete(elementId);
  560. setIntersectionDebuggerNodeText(`Element is not fully visible, won't trigger callback`, elementIntersectionDebuggerNode);
  561. }
  562. });
  563. }, [
  564. delayForMSKey,
  565. elementIdKey,
  566. onElementVisible
  567. ]);
  568. /**
  569. * We need to assign to window before render is done since we want to the observer to be available by the time rendering is done so that the elements to be observed can use it.
  570. * {@see https://kentcdodds.com/blog/useeffect-vs-uselayouteffect}
  571. */ (0,_hooks_useBrowserLayoutEffect__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(()=>{
  572. const hasIOSupport = !!window.IntersectionObserver;
  573. if (!hasIOSupport) return undefined;
  574. // no need to create a new observer if it already exists.
  575. if (!window[observerId]) {
  576. window[observerId] = new IntersectionObserver(updateEntry, {
  577. threshold,
  578. root,
  579. rootMargin
  580. });
  581. }
  582. return ()=>{
  583. // manually clear all the timeouts (if any are still around)
  584. timeouts.current.forEach((value)=>{
  585. clearTimeout(value);
  586. });
  587. if (window[observerId]) {
  588. window[observerId].disconnect();
  589. window[observerId] = undefined;
  590. }
  591. };
  592. }, [
  593. root,
  594. rootMargin,
  595. threshold,
  596. updateEntry,
  597. observerId
  598. ]);
  599. };
  600. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useGlobalIntersectionObserverWithDelay);
  601. /***/ }),
  602. /***/ 11670:
  603. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  604. "use strict";
  605. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  606. /* harmony export */ "KT": () => (/* binding */ getAboutTheQuranImageUrl),
  607. /* harmony export */ "dJ": () => (/* binding */ getLearningPlansImageUrl),
  608. /* harmony export */ "oJ": () => (/* binding */ getChapterOgImageUrl),
  609. /* harmony export */ "qW": () => (/* binding */ getDefaultOgImageUrl)
  610. /* harmony export */ });
  611. const BASE_OG_URL = "https://og.qurancdn.com";
  612. const getDefaultOgImageUrl = ({ locale })=>`${BASE_OG_URL}/api/og?lang=${locale}`;
  613. const getAboutTheQuranImageUrl = ({ locale })=>`${BASE_OG_URL}/api/og/about-the-quran?lang=${locale}`;
  614. const getLearningPlansImageUrl = ({ locale })=>`${BASE_OG_URL}/api/og/learning-plans?lang=${locale}`;
  615. const getChapterOgImageUrl = ({ chapterId , locale , verseNumber })=>{
  616. const url = `${BASE_OG_URL}/api/og/chapter/${chapterId}?lang=${locale}`;
  617. if (!verseNumber) return url;
  618. return `${url}&verse=${verseNumber}`;
  619. };
  620. /***/ }),
  621. /***/ 91450:
  622. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  623. "use strict";
  624. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  625. /* harmony export */ "Fp": () => (/* binding */ getQuranicCalendarPostOfWeek),
  626. /* harmony export */ "GG": () => (/* binding */ postReflectionViews),
  627. /* harmony export */ "P_": () => (/* binding */ followUser),
  628. /* harmony export */ "ST": () => (/* binding */ isUserFollowed)
  629. /* harmony export */ });
  630. /* unused harmony export getAllUserReflections */
  631. /* harmony import */ var _apiPaths__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65899);
  632. /* harmony import */ var _utils_auth_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(37883);
  633. const postReflectionViews = async (postId)=>(0,_utils_auth_api__WEBPACK_IMPORTED_MODULE_1__/* .postRequest */ .j0)((0,_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makePostReflectionViewsUrl */ .PI)(postId), {});
  634. const followUser = async (usernameOrId)=>(0,_utils_auth_api__WEBPACK_IMPORTED_MODULE_1__/* .postRequest */ .j0)((0,_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeFollowUserUrl */ .bE)(usernameOrId), {});
  635. const isUserFollowed = async (usernameOrId)=>{
  636. return (0,_utils_auth_api__WEBPACK_IMPORTED_MODULE_1__/* .privateFetcher */ .UK)((0,_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeIsUserFollowedUrl */ .BC)(usernameOrId));
  637. };
  638. const getAllUserReflections = async (params)=>{
  639. return privateFetcher(makeGetUserReflectionsUrl(params));
  640. };
  641. const getQuranicCalendarPostOfWeek = async (weekNumber)=>{
  642. return (0,_utils_auth_api__WEBPACK_IMPORTED_MODULE_1__/* .privateFetcher */ .UK)((0,_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeQuranicCalendarPostOfWeekUrl */ .Sv)(weekNumber));
  643. };
  644. /***/ }),
  645. /***/ 65899:
  646. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  647. "use strict";
  648. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  649. /* harmony export */ "BC": () => (/* binding */ makeIsUserFollowedUrl),
  650. /* harmony export */ "PI": () => (/* binding */ makePostReflectionViewsUrl),
  651. /* harmony export */ "Sv": () => (/* binding */ makeQuranicCalendarPostOfWeekUrl),
  652. /* harmony export */ "YV": () => (/* binding */ makeGetUserReflectionsUrl),
  653. /* harmony export */ "bE": () => (/* binding */ makeFollowUserUrl)
  654. /* harmony export */ });
  655. /* harmony import */ var _utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13830);
  656. const getPrefixedUrl = (url)=>`qf/${url}`;
  657. const makePostReflectionViewsUrl = (postId)=>(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeUrl */ .bf)(getPrefixedUrl(`posts/${postId}/views`));
  658. const makeFollowUserUrl = (userNameOrId)=>(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeUrl */ .bf)(getPrefixedUrl(`users/${userNameOrId}/follow`));
  659. const makeIsUserFollowedUrl = (userNameOrId)=>(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeUrl */ .bf)(getPrefixedUrl(`users/${userNameOrId}/is-followed`));
  660. const makeGetUserReflectionsUrl = (params)=>(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeUrl */ .bf)(getPrefixedUrl("posts"), params);
  661. const makeQuranicCalendarPostOfWeekUrl = (weekNumber)=>(0,_utils_auth_apiPaths__WEBPACK_IMPORTED_MODULE_0__/* .makeUrl */ .bf)(getPrefixedUrl(`quranic-calendar/${weekNumber}`));
  662. /***/ }),
  663. /***/ 36342:
  664. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  665. "use strict";
  666. // EXPORTS
  667. __webpack_require__.d(__webpack_exports__, {
  668. "Jc": () => (/* binding */ getAyahReflections),
  669. "pZ": () => (/* binding */ makeAyahReflectionsUrl),
  670. "GG": () => (/* binding */ postReflectionViews)
  671. });
  672. // UNUSED EXPORTS: API_HOST, makeQuranReflectApiUrl
  673. // EXTERNAL MODULE: ./src/api.ts
  674. var api = __webpack_require__(92684);
  675. // EXTERNAL MODULE: ./src/utils/qs-stringify.ts
  676. var qs_stringify = __webpack_require__(99921);
  677. ;// CONCATENATED MODULE: ./types/QuranReflect/Tab.ts
  678. var Tab;
  679. (function(Tab) {
  680. Tab["MostPopular"] = "most_popular";
  681. Tab["Newest"] = "newest";
  682. Tab["Feed"] = "feed";
  683. Tab["Public"] = "public";
  684. })(Tab || (Tab = {}));
  685. /* harmony default export */ const QuranReflect_Tab = (Tab);
  686. ;// CONCATENATED MODULE: ./src/utils/quranReflect/apiPaths.ts
  687. /* eslint-disable @typescript-eslint/naming-convention */
  688. const STAGING_API_HOST = "https://quranreflect.org";
  689. const PRODUCTION_API_HOST = "https://quranreflect.com";
  690. const isProd = process.env.NEXT_PUBLIC_VERCEL_ENV === "production";
  691. // env variables in Vercel can't be dynamic, we have to hardcode the urls here. https://stackoverflow.com/questions/44342226/next-js-error-only-absolute-urls-are-supported
  692. const API_HOST = isProd ? PRODUCTION_API_HOST : STAGING_API_HOST;
  693. const makeQuranReflectApiUrl = (path, parameters = {})=>{
  694. const params = {
  695. client_auth_token: process.env.NEXT_PUBLIC_QURAN_REFLECT_TOKEN,
  696. ...parameters
  697. };
  698. return `${API_HOST}/${path}?${(0,qs_stringify/* default */.Z)(params)}`;
  699. };
  700. /* eslint-disable import/prefer-default-export */ const makeAyahReflectionsUrl = ({ surahId , ayahNumber , locale , page =1 , tab =QuranReflect_Tab.MostPopular })=>{
  701. const surahNumber = Number(surahId) + 1;
  702. return makeQuranReflectApiUrl("posts.json", {
  703. "q[filters_attributes][0][chapter_id]": surahNumber,
  704. "q[filters_attributes][0][from]": ayahNumber,
  705. "q[filters_attributes][0][to]": ayahNumber,
  706. "q[filters_operation]": "OR",
  707. page,
  708. tab,
  709. lang: locale,
  710. feed: true
  711. });
  712. };
  713. const makeReflectionViewsUrl = (postId)=>{
  714. return makeQuranReflectApiUrl(`v1/posts/${postId}/views`);
  715. };
  716. const postReflectionViews = async (postId)=>(0,api/* fetcher */._i)(makeReflectionViewsUrl(postId), {
  717. method: "POST",
  718. headers: {
  719. "Content-Type": "application/json"
  720. }
  721. });
  722. const getAyahReflections = async (ayahReflectionsUrl)=>(0,api/* fetcher */._i)(ayahReflectionsUrl);
  723. /***/ }),
  724. /***/ 45137:
  725. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  726. "use strict";
  727. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  728. /* harmony export */ "Dp": () => (/* binding */ ONE_WEEK_REVALIDATION_PERIOD_SECONDS),
  729. /* harmony export */ "eW": () => (/* binding */ REVALIDATION_PERIOD_ON_ERROR_SECONDS),
  730. /* harmony export */ "gi": () => (/* binding */ ONE_MONTH_REVALIDATION_PERIOD_SECONDS)
  731. /* harmony export */ });
  732. /* unused harmony export ONE_DAY_REVALIDATION_PERIOD_SECONDS */
  733. const REVALIDATION_PERIOD_ON_ERROR_SECONDS = 604800; // 7 days. TODO: @osama update the naming + value when we revert this back
  734. const ONE_DAY_REVALIDATION_PERIOD_SECONDS = 86400; // 1 day
  735. const ONE_WEEK_REVALIDATION_PERIOD_SECONDS = 604800; // 7 days
  736. const ONE_MONTH_REVALIDATION_PERIOD_SECONDS = 2592000; // 30 days
  737. /***/ }),
  738. /***/ 75184:
  739. /***/ ((module) => {
  740. "use strict";
  741. module.exports = require("@reduxjs/toolkit");
  742. /***/ }),
  743. /***/ 58097:
  744. /***/ ((module) => {
  745. "use strict";
  746. module.exports = require("@sentry/nextjs");
  747. /***/ }),
  748. /***/ 59003:
  749. /***/ ((module) => {
  750. "use strict";
  751. module.exports = require("classnames");
  752. /***/ }),
  753. /***/ 59606:
  754. /***/ ((module) => {
  755. "use strict";
  756. module.exports = require("humps");
  757. /***/ }),
  758. /***/ 12372:
  759. /***/ ((module) => {
  760. "use strict";
  761. module.exports = require("lodash/findKey");
  762. /***/ }),
  763. /***/ 98492:
  764. /***/ ((module) => {
  765. "use strict";
  766. module.exports = require("lodash/groupBy");
  767. /***/ }),
  768. /***/ 35526:
  769. /***/ ((module) => {
  770. "use strict";
  771. module.exports = require("lodash/random");
  772. /***/ }),
  773. /***/ 64042:
  774. /***/ ((module) => {
  775. "use strict";
  776. module.exports = require("lodash/range");
  777. /***/ }),
  778. /***/ 16641:
  779. /***/ ((module) => {
  780. "use strict";
  781. module.exports = require("next-seo");
  782. /***/ }),
  783. /***/ 60866:
  784. /***/ ((module) => {
  785. "use strict";
  786. module.exports = require("next-translate/useTranslation");
  787. /***/ }),
  788. /***/ 3280:
  789. /***/ ((module) => {
  790. "use strict";
  791. module.exports = require("next/dist/shared/lib/app-router-context.js");
  792. /***/ }),
  793. /***/ 92796:
  794. /***/ ((module) => {
  795. "use strict";
  796. module.exports = require("next/dist/shared/lib/head-manager-context.js");
  797. /***/ }),
  798. /***/ 3539:
  799. /***/ ((module) => {
  800. "use strict";
  801. module.exports = require("next/dist/shared/lib/i18n/detect-domain-locale.js");
  802. /***/ }),
  803. /***/ 34014:
  804. /***/ ((module) => {
  805. "use strict";
  806. module.exports = require("next/dist/shared/lib/i18n/normalize-locale-path.js");
  807. /***/ }),
  808. /***/ 78524:
  809. /***/ ((module) => {
  810. "use strict";
  811. module.exports = require("next/dist/shared/lib/is-plain-object.js");
  812. /***/ }),
  813. /***/ 95832:
  814. /***/ ((module) => {
  815. "use strict";
  816. module.exports = require("next/dist/shared/lib/loadable.js");
  817. /***/ }),
  818. /***/ 78020:
  819. /***/ ((module) => {
  820. "use strict";
  821. module.exports = require("next/dist/shared/lib/mitt.js");
  822. /***/ }),
  823. /***/ 64406:
  824. /***/ ((module) => {
  825. "use strict";
  826. module.exports = require("next/dist/shared/lib/page-path/denormalize-page-path.js");
  827. /***/ }),
  828. /***/ 24964:
  829. /***/ ((module) => {
  830. "use strict";
  831. module.exports = require("next/dist/shared/lib/router-context.js");
  832. /***/ }),
  833. /***/ 93431:
  834. /***/ ((module) => {
  835. "use strict";
  836. module.exports = require("next/dist/shared/lib/router/utils/add-locale.js");
  837. /***/ }),
  838. /***/ 11751:
  839. /***/ ((module) => {
  840. "use strict";
  841. module.exports = require("next/dist/shared/lib/router/utils/add-path-prefix.js");
  842. /***/ }),
  843. /***/ 46220:
  844. /***/ ((module) => {
  845. "use strict";
  846. module.exports = require("next/dist/shared/lib/router/utils/compare-states.js");
  847. /***/ }),
  848. /***/ 10299:
  849. /***/ ((module) => {
  850. "use strict";
  851. module.exports = require("next/dist/shared/lib/router/utils/format-next-pathname-info.js");
  852. /***/ }),
  853. /***/ 23938:
  854. /***/ ((module) => {
  855. "use strict";
  856. module.exports = require("next/dist/shared/lib/router/utils/format-url.js");
  857. /***/ }),
  858. /***/ 29565:
  859. /***/ ((module) => {
  860. "use strict";
  861. module.exports = require("next/dist/shared/lib/router/utils/get-asset-path-from-route.js");
  862. /***/ }),
  863. /***/ 35789:
  864. /***/ ((module) => {
  865. "use strict";
  866. module.exports = require("next/dist/shared/lib/router/utils/get-next-pathname-info.js");
  867. /***/ }),
  868. /***/ 1897:
  869. /***/ ((module) => {
  870. "use strict";
  871. module.exports = require("next/dist/shared/lib/router/utils/is-bot.js");
  872. /***/ }),
  873. /***/ 1428:
  874. /***/ ((module) => {
  875. "use strict";
  876. module.exports = require("next/dist/shared/lib/router/utils/is-dynamic.js");
  877. /***/ }),
  878. /***/ 28854:
  879. /***/ ((module) => {
  880. "use strict";
  881. module.exports = require("next/dist/shared/lib/router/utils/parse-path.js");
  882. /***/ }),
  883. /***/ 91292:
  884. /***/ ((module) => {
  885. "use strict";
  886. module.exports = require("next/dist/shared/lib/router/utils/parse-relative-url.js");
  887. /***/ }),
  888. /***/ 34567:
  889. /***/ ((module) => {
  890. "use strict";
  891. module.exports = require("next/dist/shared/lib/router/utils/path-has-prefix.js");
  892. /***/ }),
  893. /***/ 80979:
  894. /***/ ((module) => {
  895. "use strict";
  896. module.exports = require("next/dist/shared/lib/router/utils/querystring.js");
  897. /***/ }),
  898. /***/ 93297:
  899. /***/ ((module) => {
  900. "use strict";
  901. module.exports = require("next/dist/shared/lib/router/utils/remove-trailing-slash.js");
  902. /***/ }),
  903. /***/ 36052:
  904. /***/ ((module) => {
  905. "use strict";
  906. module.exports = require("next/dist/shared/lib/router/utils/resolve-rewrites.js");
  907. /***/ }),
  908. /***/ 84226:
  909. /***/ ((module) => {
  910. "use strict";
  911. module.exports = require("next/dist/shared/lib/router/utils/route-matcher.js");
  912. /***/ }),
  913. /***/ 95052:
  914. /***/ ((module) => {
  915. "use strict";
  916. module.exports = require("next/dist/shared/lib/router/utils/route-regex.js");
  917. /***/ }),
  918. /***/ 59232:
  919. /***/ ((module) => {
  920. "use strict";
  921. module.exports = require("next/dist/shared/lib/utils.js");
  922. /***/ }),
  923. /***/ 71853:
  924. /***/ ((module) => {
  925. "use strict";
  926. module.exports = require("next/router");
  927. /***/ }),
  928. /***/ 16689:
  929. /***/ ((module) => {
  930. "use strict";
  931. module.exports = require("react");
  932. /***/ }),
  933. /***/ 20997:
  934. /***/ ((module) => {
  935. "use strict";
  936. module.exports = require("react/jsx-runtime");
  937. /***/ }),
  938. /***/ 52648:
  939. /***/ ((module) => {
  940. "use strict";
  941. module.exports = require("refresh-fetch");
  942. /***/ }),
  943. /***/ 66704:
  944. /***/ ((module) => {
  945. "use strict";
  946. module.exports = import("@radix-ui/react-tooltip");;
  947. /***/ }),
  948. /***/ 88813:
  949. /***/ ((module) => {
  950. "use strict";
  951. module.exports = import("firebase/compat/analytics");;
  952. /***/ }),
  953. /***/ 33773:
  954. /***/ ((module) => {
  955. "use strict";
  956. module.exports = import("firebase/compat/app");;
  957. /***/ }),
  958. /***/ 69915:
  959. /***/ ((module) => {
  960. "use strict";
  961. module.exports = import("js-cookie");;
  962. /***/ }),
  963. /***/ 15941:
  964. /***/ ((module) => {
  965. "use strict";
  966. module.exports = import("swr");;
  967. /***/ }),
  968. /***/ 79847:
  969. /***/ ((module) => {
  970. "use strict";
  971. module.exports = import("swr/immutable");;
  972. /***/ }),
  973. /***/ 63477:
  974. /***/ ((module) => {
  975. "use strict";
  976. module.exports = require("querystring");
  977. /***/ })
  978. };
  979. ;
  980. // load runtime
  981. var __webpack_require__ = require("../../webpack-runtime.js");
  982. __webpack_require__.C(exports);
  983. var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
  984. var __webpack_exports__ = __webpack_require__.X(0, [11497,79165,96954,96270,24709,57933,61239,25869,50497,76410,13830,37883,22197,12951,36049,41051], () => (__webpack_exec__(50478)));
  985. module.exports = __webpack_exports__;
  986. })();
  987. //# sourceMappingURL=reflections.js.map